<!DOCTYPE html>
<html class="x-admin-sm">
    
    <head>
        <meta charset="UTF-8">
        <title>规则设置</title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
        <link rel="stylesheet" href="__HOME_CSS__/font.css">
        <link rel="stylesheet" href="__HOME_CSS__/xadmin.css">
        <script src="__HOME_JS__/echarts.min.js"></script>
        <script src="__HOME_LIB__/layui/layui.js" charset="utf-8"></script>
        <script type="text/javascript" src="__HOME_JS__/xadmin.js"></script>
        <script type="text/javascript" src="__HOME_JS__/jquery.min.js"></script>
        <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
        <!--[if lt IE 9]>
          <script src="__HOME_JS__/html5.min.js"></script>
          <script src="__HOME_JS__/respond.min.js"></script>
        <![endif]-->
    </head>

    <body>
        <div class="x-nav">
            <span class="layui-breadcrumb">
                <a href="">后台首页</a>
                <a href="">管理员设置</a>
                <a>
                    <cite>规则设置</cite></a>
            </span>
            <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" onclick="location.reload()" title="刷新">
                <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i>
            </a>
        </div>
        <div class="layui-fluid">
            <div class="layui-row layui-col-space15">
                <div class="layui-col-md12">
                    <div class="layui-card">
                        <div class="layui-card-body ">
                            
                            <hr>
                            <blockquote class="layui-elem-quote">部分设置会影响后台后台运行，如有疑问请向我司寻求技术支持</blockquote>
                        </div>
                        
                        <div class="layui-card-body ">
                            <table class="layui-table layui-form">
                                <thead>
                                <tr>
                                    <th width="200">设备使用时长</th>
                                </thead>

                                <tbody>
                                <tr>
                                    <td><input placeholder="请输入整数" type="text" id="device_use_time" class="layui-input x-sort" name="device_use_time" value="{$row.device_use_time.value}">小时
                                    </td>
                                </tr>

                                </tbody>
                            </table>
                        </div>
                        <div class="layui-card-body ">
                            <table class="layui-table layui-form">
                                <thead>
                                <tr>
                                    <th width="200">柜门未关异常时间</th>
                                </thead>

                                <tbody>
                                <tr>
                                    <td><input placeholder="请输入整数" type="text" id="door_not_close_time" class="layui-input x-sort" name="door_not_close_time" value="{$row.door_not_close_time.value}">分钟
                                    </td>
                                </tr>

                                </tbody>
                            </table>
                        </div>
                        <div class="layui-card-body ">
                            <div class="page">

                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <script>
          layui.use(['form'], function(){
            form = layui.form;

          });


          $('#device_use_time').on('change',function () {
              var door_not_close_time = $('#door_not_close_time').val();
              var device_use_time = $('#device_use_time').val();
              $.ajax({
                  url:"{:url('index/admin/editrules')}",
                  type:"POST",
                  data:{
                      device_use_time:device_use_time,
                      door_not_close_time:door_not_close_time,
                  },
                  success:function (ret) {
                      layer.msg(ret.msg)
                  }
              });
          });

          $('#door_not_close_time').on('change',function () {
              var door_not_close_time = $('#door_not_close_time').val();
              var device_use_time = $('#device_use_time').val();
              $.ajax({
                  url:"{:url('index/admin/editrules')}",
                  type:"POST",
                  data:{
                      device_use_time:device_use_time,
                      door_not_close_time:door_not_close_time,
                  },
                  success:function (ret) {
                      layer.msg(ret.msg)
                  }
              });
          })

          var cateIds = [];
          function getCateId(cateId) {
              $("tbody tr[fid="+cateId+"]").each(function(index, el) {
                  id = $(el).attr('cate-id');
                  cateIds.push(id);
                  getCateId(id);
              });
          }
   
        </script>
    </body>
</html>
